﻿using System;
using System.Collections.Generic;
using System.Drawing;

namespace AppRPG.PhysObject
{
	public class InteractiveManager
	{
		private readonly List<PhysObject> _physObjects;

        private readonly Player _player;

		public InteractiveManager(Player player)
		{
            _player = player;

			_physObjects = new List<PhysObject>();
		}

        public PhysObject GetInteractiveObjects()
		{
            Rectangle playerRect = new Rectangle(_player.GetPosition(),
                                                 _player.GetDimension());

            foreach (PhysObject physObject in _physObjects)
            {
                Rectangle physObjectRect = new Rectangle(physObject.GetPosition(),
                                                         physObject.GetDimension());

                if (playerRect.IntersectsWith(physObjectRect))
                {
                    return physObject;
                }
            }

            return null;
		}
	}
}
